<template>
	<view>
		<view class="introduce_head">
			<dsl-navbar title="" isBack bgTopImg="" backBg='white'></dsl-navbar>
			<view class="padding flex align-center">

				<image :src="companyData.image?companyData.image:'/static/userImg.png'" mode="" class="introduce_image"
				:class="{'animation-scale-up':companyData.image!=''}"
				>
				</image>
				<view class="margin-left">
					<view class="introduce_title">{{companyData.name || '暂未填写企业名称'}}</view>
					<!-- <view class="introduce_content">{{companyData.rongzi}}</view> -->
					<!-- /{{companyData.staff}}人/{{companyData.classify}} -->
				</view>
			</view>
		</view>
		<view class="introduce_body padding">
			<view class="align-center">
				<view class="enterprise_left"></view>
				<view class="margin-left-sm">企业介绍</view>
			</view>
			<view class="text-sm margin-top">
				<text>
					{{companyData.introduce}}
				</text>
			</view>
		</view>

		<view class="introduce_body padding" style="margin-top: 20rpx;" @click="mapMen">
			<view class="align-center">
				<view class="enterprise_left"></view>
				<view class="margin-left-sm">企业地址</view>
			</view>
			<view class="text-sm margin-top align-center">
				<image src="/static/icon/imgdingwei-1.png" mode="" class="icon_address"></image>
				<text class="margin-left-sm" style="color: #666666;">{{companyData.address}}</text>
			</view>
		</view>
		<view class="introduce_body padding" style="margin-top: 20rpx;">
			<view class="align-center">
				<view class="enterprise_left"></view>
				<view class="margin-left-sm">环境照片</view>
			</view>
			<view class="flex align-center margin-top">
				<view v-for="(item,index) in companyData.images" v-if="index<9"
					@click="preview(index,companyData.images)">
					<image :src="item" mode="aspectFill" class="company_image margin-right-sm"></image>
				</view>
			</view>
		</view>
		<view class="introduce_body padding" style="margin-top: 20rpx;">
			<view class="align-center">
				<view class="enterprise_left"></view>
				<view class="margin-left-sm">该企业其他岗位</view>
			</view>
			<view class="padding solid-bottom" v-for="(item,index) in companyList" :key='index'>
				<view class="rowsb">
					<view class="text-lg text-black text-bold">{{item.worktype ||'暂无'}}</view>
					<view class="text-sm text-red">￥{{item.money}}</view>
				</view>
				<view class="rowsb align-center">
					<view class="flex flex-wrap">
						<view class="enterpris_table" >{{item.fuli ||'暂无'}}</view>
					</view>
					<view class="text-sm text-gray"> {{item.fangshi==1?'日结':'周结'}}</view>
				</view>
				<view class="rowsb text-sm text-gray margin-top-sm">
					<view>招聘{{item.sum}}人</view>
					<view style="width: 300rpx;" class="one_overflow">{{item.address}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		preview
	} from '../../common/updataImgList.js'
	import {
		getcompany,
		firmPost
	} from '@/common/path.js'
	export default {
		data() {
			return {
				detailId: '', // id
				companyData: {}, //公司介绍
				companyList:[],//企业下的岗位
			}
		},
		//生命周期函数
		onReady() {},
		onLoad(option) {
			this.detailId = option.id //企业id
			this.getcompany() //企业介绍
			this.firmPost() //企业下的岗位列表
		},
		onShow() {},
		methods: {
			//预览
			preview(index, array) {
				preview(index, array)
			},
			//打开地图
			mapMen() {
				let _this = this
				let data = {
					latitude: parseFloat(_this.companyData.lat),
					longitude: parseFloat(_this.companyData.lon),
					success: function() {
						console.log('success');
					}
				}
				console.log(data);
				uni.openLocation(data);
			},
			//企业介绍
			getcompany() {
				let data = {
					type: 3,
					userid: this.detailId
				}
				this.Http.POST(getcompany, data)
					.then((res) => {
						console.log('[介绍]', res);
						if (res.code == 1) {
							this.companyData = res.data
						} 
					})
			},
			//企业下的岗位
			firmPost() {
				let data = {
					id:this.detailId
				}
				this.Http.POST(firmPost, data)
					.then(res => {
						if (res.code == 1) {
							console.log('[企业岗位列表]', res);
							this.companyList = res.data
						}
					})
			}
		},
		computed: {},
		components: {}
	}
</script>

<style>
	page {
		background: #F7F8FB;
	}

	/* 头部 */
	.introduce_head {
		width: 750rpx;
		height: 408rpx;
		background: #000000;
		opacity: 0.8;
	}

	.introduce_title {
		width: 432rpx;
		font-size: 36rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #FFFFFF;
		opacity: 1;
	}

	.introduce_image {
		width: 150rpx;
		height: 150rpx;
		opacity: 1;
		border-radius: 10rpx;
	}

	.introduce_content {
		font-size: 24rpx;
		color: white;
		margin-top: 30rpx;
	}

	/* 介绍中间部分 */
	.introduce_body {
		width: 694rpx;
		background: #FFFFFF;
		opacity: 1;
		border-radius: 20rpx;
		margin: 0 auto;
		margin-top: -20rpx;
		position: relative;
		z-index: 1;

	}

	.enterprise_left {
		width: 4rpx;
		height: 30rpx;
		background: #00D88F;
		opacity: 1;
		border-radius: 2rpx;
	}

	.icon_address {
		width: 25rpx;
		height: 30rpx;
	}

	.company_image {
		width: 200rpx;
		height: 140rpx;
		background: #EEEEEE;
		opacity: 1;
		border-radius: 10rpx;
	}

	.enterpris_table {
		height: 36rpx;
		background: #EEEEEE;
		opacity: 1;
		border-radius: 6rpx;
		line-height: 36rpx;
		text-align: center;
		padding: 0rpx 20rpx;
		font-size: 20rpx;
		margin-right: 20rpx;
		margin-top: 20rpx;
	}

	.post_image {
		width: 62rpx;
		height: 62rpx;
		background: #00D88F;
		border-radius: 10rpx;
	}
</style>
